<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Git 备忘清单 | ShuangChenYue</title>
    <meta name="generator" content="VuePress 1.9.10">
    <link rel="icon" href="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg">
    <meta name="description" content="满招损，谦受益">
    <meta name="keywords" content="专注于Cpp语言的旅行者">
    
    <link rel="preload" href="/assets/css/0.styles.952d6952.css" as="style"><link rel="preload" href="/assets/js/app.67adcfd9.js" as="script"><link rel="preload" href="/assets/js/4.9aaa1650.js" as="script"><link rel="preload" href="/assets/js/1.5474518c.js" as="script"><link rel="preload" href="/assets/js/3.593d14fc.js" as="script"><link rel="preload" href="/assets/js/162.1d48f266.js" as="script"><link rel="prefetch" href="/assets/js/10.3242746b.js"><link rel="prefetch" href="/assets/js/100.9224de43.js"><link rel="prefetch" href="/assets/js/101.f0d1b059.js"><link rel="prefetch" href="/assets/js/102.996bfc6d.js"><link rel="prefetch" href="/assets/js/103.9bfdbd6f.js"><link rel="prefetch" href="/assets/js/104.8613f283.js"><link rel="prefetch" href="/assets/js/105.aa6e809e.js"><link rel="prefetch" href="/assets/js/106.90192392.js"><link rel="prefetch" href="/assets/js/107.e82a40b7.js"><link rel="prefetch" href="/assets/js/108.994cd438.js"><link rel="prefetch" href="/assets/js/109.ec15acc2.js"><link rel="prefetch" href="/assets/js/11.c04b41c1.js"><link rel="prefetch" href="/assets/js/110.c32d8576.js"><link rel="prefetch" href="/assets/js/111.453b5d50.js"><link rel="prefetch" href="/assets/js/112.ffbdb3a4.js"><link rel="prefetch" href="/assets/js/113.12b8ad7d.js"><link rel="prefetch" href="/assets/js/114.899d2998.js"><link rel="prefetch" href="/assets/js/115.b7ad9576.js"><link rel="prefetch" href="/assets/js/116.a8394748.js"><link rel="prefetch" href="/assets/js/117.0edfe25b.js"><link rel="prefetch" href="/assets/js/118.9161b1fe.js"><link rel="prefetch" href="/assets/js/119.be59e21b.js"><link rel="prefetch" href="/assets/js/12.41437bf6.js"><link rel="prefetch" href="/assets/js/120.bcf439fb.js"><link rel="prefetch" href="/assets/js/121.c3d251b8.js"><link rel="prefetch" href="/assets/js/122.62b1caba.js"><link rel="prefetch" href="/assets/js/123.787c2ab0.js"><link rel="prefetch" href="/assets/js/124.a880746f.js"><link rel="prefetch" href="/assets/js/125.d8edfe7b.js"><link rel="prefetch" href="/assets/js/126.4ff01546.js"><link rel="prefetch" href="/assets/js/127.9416d1ff.js"><link rel="prefetch" href="/assets/js/128.01a4a7a0.js"><link rel="prefetch" href="/assets/js/129.76876665.js"><link rel="prefetch" href="/assets/js/13.922328e9.js"><link rel="prefetch" href="/assets/js/130.7f631dd9.js"><link rel="prefetch" href="/assets/js/131.c9e0fde9.js"><link rel="prefetch" href="/assets/js/132.1c04cde5.js"><link rel="prefetch" href="/assets/js/133.e8f381cd.js"><link rel="prefetch" href="/assets/js/134.03d19f8b.js"><link rel="prefetch" href="/assets/js/135.44607494.js"><link rel="prefetch" href="/assets/js/136.6a1eb3c9.js"><link rel="prefetch" href="/assets/js/137.27898fd1.js"><link rel="prefetch" href="/assets/js/138.5bc0cf54.js"><link rel="prefetch" href="/assets/js/139.c2d1addc.js"><link rel="prefetch" href="/assets/js/14.e54d7526.js"><link rel="prefetch" href="/assets/js/140.052ec8e4.js"><link rel="prefetch" href="/assets/js/141.131abb5a.js"><link rel="prefetch" href="/assets/js/142.6ba6c07b.js"><link rel="prefetch" href="/assets/js/143.5dd51d22.js"><link rel="prefetch" href="/assets/js/144.b45afca8.js"><link rel="prefetch" href="/assets/js/145.faa9fb04.js"><link rel="prefetch" href="/assets/js/146.b54c024d.js"><link rel="prefetch" href="/assets/js/147.a1223242.js"><link rel="prefetch" href="/assets/js/148.4767bcb2.js"><link rel="prefetch" href="/assets/js/149.b65ab046.js"><link rel="prefetch" href="/assets/js/15.7082a3da.js"><link rel="prefetch" href="/assets/js/150.9bd8c175.js"><link rel="prefetch" href="/assets/js/151.9f830e96.js"><link rel="prefetch" href="/assets/js/152.41cde7f0.js"><link rel="prefetch" href="/assets/js/153.f57d65e0.js"><link rel="prefetch" href="/assets/js/154.5d7c8d51.js"><link rel="prefetch" href="/assets/js/155.0ae99532.js"><link rel="prefetch" href="/assets/js/156.5a54e043.js"><link rel="prefetch" href="/assets/js/157.c25b5d40.js"><link rel="prefetch" href="/assets/js/158.aa025b46.js"><link rel="prefetch" href="/assets/js/159.47939d88.js"><link rel="prefetch" href="/assets/js/16.fc775b7b.js"><link rel="prefetch" href="/assets/js/160.f8624459.js"><link rel="prefetch" href="/assets/js/161.7a075dc2.js"><link rel="prefetch" href="/assets/js/163.5d68a99f.js"><link rel="prefetch" href="/assets/js/164.1262d0e5.js"><link rel="prefetch" href="/assets/js/165.2ccf0bdd.js"><link rel="prefetch" href="/assets/js/166.21ece4d9.js"><link rel="prefetch" href="/assets/js/167.bf8adb95.js"><link rel="prefetch" href="/assets/js/168.1cb8440d.js"><link rel="prefetch" href="/assets/js/169.1dd1e396.js"><link rel="prefetch" href="/assets/js/17.ecc7be70.js"><link rel="prefetch" href="/assets/js/170.c29ec18f.js"><link rel="prefetch" href="/assets/js/171.38820827.js"><link rel="prefetch" href="/assets/js/172.bbc8ffc6.js"><link rel="prefetch" href="/assets/js/173.470e21e7.js"><link rel="prefetch" href="/assets/js/174.3c2df318.js"><link rel="prefetch" href="/assets/js/175.d2690cdb.js"><link rel="prefetch" href="/assets/js/176.9ca64696.js"><link rel="prefetch" href="/assets/js/177.76f3271d.js"><link rel="prefetch" href="/assets/js/178.d7d9def2.js"><link rel="prefetch" href="/assets/js/179.b5644743.js"><link rel="prefetch" href="/assets/js/18.31fe7ecd.js"><link rel="prefetch" href="/assets/js/180.7592d5ef.js"><link rel="prefetch" href="/assets/js/181.5cb77d35.js"><link rel="prefetch" href="/assets/js/182.6fa5633c.js"><link rel="prefetch" href="/assets/js/183.b3a53d1b.js"><link rel="prefetch" href="/assets/js/184.3815c537.js"><link rel="prefetch" href="/assets/js/185.bcf4ab71.js"><link rel="prefetch" href="/assets/js/186.1cc02f6d.js"><link rel="prefetch" href="/assets/js/187.8b425fb7.js"><link rel="prefetch" href="/assets/js/188.44ccbd02.js"><link rel="prefetch" href="/assets/js/189.353b35e3.js"><link rel="prefetch" href="/assets/js/19.520992d5.js"><link rel="prefetch" href="/assets/js/190.c284595f.js"><link rel="prefetch" href="/assets/js/191.788ecc2d.js"><link rel="prefetch" href="/assets/js/192.712a164e.js"><link rel="prefetch" href="/assets/js/193.da58aba3.js"><link rel="prefetch" href="/assets/js/194.6b1b1f4d.js"><link rel="prefetch" href="/assets/js/195.c31d5c39.js"><link rel="prefetch" href="/assets/js/196.f6670c4d.js"><link rel="prefetch" href="/assets/js/197.5a1f50ab.js"><link rel="prefetch" href="/assets/js/2.ab565158.js"><link rel="prefetch" href="/assets/js/20.69e29cdc.js"><link rel="prefetch" href="/assets/js/21.2fd424ad.js"><link rel="prefetch" href="/assets/js/22.d4c0be54.js"><link rel="prefetch" href="/assets/js/23.4bb90ecc.js"><link rel="prefetch" href="/assets/js/24.c01be6b2.js"><link rel="prefetch" href="/assets/js/25.c8833687.js"><link rel="prefetch" href="/assets/js/26.8042b555.js"><link rel="prefetch" href="/assets/js/27.0d5fa4c0.js"><link rel="prefetch" href="/assets/js/28.f9735b8b.js"><link rel="prefetch" href="/assets/js/29.3af53626.js"><link rel="prefetch" href="/assets/js/30.5f1b56d1.js"><link rel="prefetch" href="/assets/js/31.544b2649.js"><link rel="prefetch" href="/assets/js/32.aa321988.js"><link rel="prefetch" href="/assets/js/33.6aba2c86.js"><link rel="prefetch" href="/assets/js/34.e1bbff24.js"><link rel="prefetch" href="/assets/js/35.233f76e0.js"><link rel="prefetch" href="/assets/js/36.cb773972.js"><link rel="prefetch" href="/assets/js/37.393d9c59.js"><link rel="prefetch" href="/assets/js/38.e2d530c5.js"><link rel="prefetch" href="/assets/js/39.acaf1cc0.js"><link rel="prefetch" href="/assets/js/40.358f731e.js"><link rel="prefetch" href="/assets/js/41.ded24b7e.js"><link rel="prefetch" href="/assets/js/42.b9f683c3.js"><link rel="prefetch" href="/assets/js/43.c8fb3e66.js"><link rel="prefetch" href="/assets/js/44.633142da.js"><link rel="prefetch" href="/assets/js/45.6095e772.js"><link rel="prefetch" href="/assets/js/46.421d8c7a.js"><link rel="prefetch" href="/assets/js/47.da50fe47.js"><link rel="prefetch" href="/assets/js/48.15ff5726.js"><link rel="prefetch" href="/assets/js/49.b662e624.js"><link rel="prefetch" href="/assets/js/5.c1b8a209.js"><link rel="prefetch" href="/assets/js/50.a8bc75df.js"><link rel="prefetch" href="/assets/js/51.51e36ae7.js"><link rel="prefetch" href="/assets/js/52.54cc6e51.js"><link rel="prefetch" href="/assets/js/53.4173561d.js"><link rel="prefetch" href="/assets/js/54.7cab8416.js"><link rel="prefetch" href="/assets/js/55.3d7317d3.js"><link rel="prefetch" href="/assets/js/56.3c22255b.js"><link rel="prefetch" href="/assets/js/57.18e46e30.js"><link rel="prefetch" href="/assets/js/58.aad57f31.js"><link rel="prefetch" href="/assets/js/59.7897f6a7.js"><link rel="prefetch" href="/assets/js/6.3131f88a.js"><link rel="prefetch" href="/assets/js/60.5cd0051a.js"><link rel="prefetch" href="/assets/js/61.d9606403.js"><link rel="prefetch" href="/assets/js/62.aede9df0.js"><link rel="prefetch" href="/assets/js/63.2c30e554.js"><link rel="prefetch" href="/assets/js/64.18228ab7.js"><link rel="prefetch" href="/assets/js/65.27cb3fba.js"><link rel="prefetch" href="/assets/js/66.2fa6c2dc.js"><link rel="prefetch" href="/assets/js/67.d274a8df.js"><link rel="prefetch" href="/assets/js/68.3069cfcf.js"><link rel="prefetch" href="/assets/js/69.4c28600f.js"><link rel="prefetch" href="/assets/js/7.89e6165d.js"><link rel="prefetch" href="/assets/js/70.4175440c.js"><link rel="prefetch" href="/assets/js/71.2ee6b435.js"><link rel="prefetch" href="/assets/js/72.c75e3bb8.js"><link rel="prefetch" href="/assets/js/73.6f8b8211.js"><link rel="prefetch" href="/assets/js/74.6c7720cf.js"><link rel="prefetch" href="/assets/js/75.cccfb229.js"><link rel="prefetch" href="/assets/js/76.f022e5da.js"><link rel="prefetch" href="/assets/js/77.dab46206.js"><link rel="prefetch" href="/assets/js/78.ca574b2a.js"><link rel="prefetch" href="/assets/js/79.3d75e618.js"><link rel="prefetch" href="/assets/js/80.091749b1.js"><link rel="prefetch" href="/assets/js/81.14db0e21.js"><link rel="prefetch" href="/assets/js/82.8a2b1809.js"><link rel="prefetch" href="/assets/js/83.84a4b599.js"><link rel="prefetch" href="/assets/js/84.11d7c222.js"><link rel="prefetch" href="/assets/js/85.273d4388.js"><link rel="prefetch" href="/assets/js/86.fb40e20c.js"><link rel="prefetch" href="/assets/js/87.3316639e.js"><link rel="prefetch" href="/assets/js/88.dfc52200.js"><link rel="prefetch" href="/assets/js/89.8d615f6e.js"><link rel="prefetch" href="/assets/js/90.1d9f08bb.js"><link rel="prefetch" href="/assets/js/91.566813e7.js"><link rel="prefetch" href="/assets/js/92.d13c6f41.js"><link rel="prefetch" href="/assets/js/93.845c42a0.js"><link rel="prefetch" href="/assets/js/94.20a37b77.js"><link rel="prefetch" href="/assets/js/95.1a498005.js"><link rel="prefetch" href="/assets/js/96.39fa7f4b.js"><link rel="prefetch" href="/assets/js/97.50f7170e.js"><link rel="prefetch" href="/assets/js/98.dd2e15d6.js"><link rel="prefetch" href="/assets/js/99.ef7ea06a.js"><link rel="prefetch" href="/assets/js/vendors~docsearch.ae6b1de9.js">
    <link rel="stylesheet" href="/assets/css/0.styles.952d6952.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg" alt="ShuangChenYue" class="logo"> <span class="site-name can-hide">ShuangChenYue</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="嵌入式软件开发" class="dropdown-title"><!----> <span class="title" style="display:;">嵌入式软件开发</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d142c2/" class="nav-link">电子嵌入式通信协议</a></li><li class="dropdown-item"><!----> <a href="/pages/4c6bf3/" class="nav-link">深入浅出SSD</a></li><li class="dropdown-item"><!----> <a href="/pages/d3f36a/" class="nav-link">文件系统</a></li><li class="dropdown-item"><!----> <a href="/pages/e0cca7/" class="nav-link">汇编语言</a></li><li class="dropdown-item"><!----> <a href="/pages/fab2d7/" class="nav-link">STM32</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" class="nav-link">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/db6fb8/" aria-current="page" class="nav-link router-link-exact-active router-link-active">Git备忘清单</a></li><li class="dropdown-item"><!----> <a href="/pages/e1081f/" class="nav-link">Git 创建删除远程分支</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/1ab9a6/" class="nav-link">Shell 脚本学习笔记</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/907786/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/a2d21e/" class="nav-link">kylinV10-SP1 安装 QT</a></li><li class="dropdown-item"><!----> <a href="/pages/b561cf/" class="nav-link">高并发内存池</a></li><li class="dropdown-item"><!----> <a href="/pages/6ab6d1/" class="nav-link">USBGUARD 项目编译环境配置</a></li><li class="dropdown-item"><!----> <a href="/pages/883f02/" class="nav-link">Power_Destory 项目</a></li><li class="dropdown-item"><!----> <a href="/pages/479472/" class="nav-link">U 盘清除工具编译教程</a></li><li class="dropdown-item"><!----> <a href="/pages/9c4241/" class="nav-link">个人博客代码推送教程</a></li><li class="dropdown-item"><!----> <a href="/pages/3ad765/" class="nav-link">SVN Trunk Branches的Merge操作</a></li><li class="dropdown-item"><!----> <a href="/pages/0c0ca8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="MFC" class="dropdown-title"><!----> <span class="title" style="display:;">MFC</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/a4b108/" class="nav-link">MFC编程随记</a></li><li class="dropdown-item"><!----> <a href="/pages/41acbd/" class="nav-link">MFC实现ini配置文件的读取</a></li><li class="dropdown-item"><!----> <a href="/pages/951a7a/" class="nav-link">MFC实现点击列表头排序</a></li><li class="dropdown-item"><!----> <a href="/pages/a8598f/" class="nav-link">贴图法美化Button按钮</a></li><li class="dropdown-item"><!----> <a href="/pages/054516/" class="nav-link">MFC使用细节</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="闪存" class="dropdown-title"><!----> <span class="title" style="display:;">闪存</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/b925b8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li><li class="dropdown-item"><!----> <a href="/pages/28ec23/" class="nav-link">NAND Flash</a></li><li class="dropdown-item"><!----> <a href="/pages/62bf40/" class="nav-link">ARM 处理器</a></li><li class="dropdown-item"><!----> <a href="/pages/1a9374/" class="nav-link">嵌入式基础知识-存储器</a></li><li class="dropdown-item"><!----> <a href="/pages/aac5e3/" class="nav-link">闪存存储和制造技术概述</a></li><li class="dropdown-item"><!----> <a href="/pages/8f6056/" class="nav-link">芯片IO驱动力</a></li><li class="dropdown-item"><!----> <a href="/pages/d146b8/" class="nav-link">主流先进封装技术介绍</a></li><li class="dropdown-item"><!----> <a href="/pages/16f0ba/" class="nav-link">NAND Flash基础</a></li><li class="dropdown-item"><!----> <a href="/pages/90d8d0/" class="nav-link">基于PA算法的FTL引导</a></li><li class="dropdown-item"><!----> <a href="/pages/eb672b/" class="nav-link">SD逻辑擦除和物理擦除</a></li><li class="dropdown-item"><!----> <a href="/pages/747121/" class="nav-link">NAND Flash的SDR、ONFI、DDR接口</a></li><li class="dropdown-item"><!----> <a href="/pages/1eb351/" class="nav-link">【详解】Nand Flash必看知识</a></li><li class="dropdown-item"><!----> <a href="/pages/d2512a/" class="nav-link">【两万字详解】Nand Flash必看知识</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li><li class="dropdown-item"><!----> <a href="/pages/c7c01f/" class="nav-link">完美世界秋招 C++ 游戏开发面经(Cpp部分)</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="嵌入式软件开发" class="dropdown-title"><!----> <span class="title" style="display:;">嵌入式软件开发</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d142c2/" class="nav-link">电子嵌入式通信协议</a></li><li class="dropdown-item"><!----> <a href="/pages/4c6bf3/" class="nav-link">深入浅出SSD</a></li><li class="dropdown-item"><!----> <a href="/pages/d3f36a/" class="nav-link">文件系统</a></li><li class="dropdown-item"><!----> <a href="/pages/e0cca7/" class="nav-link">汇编语言</a></li><li class="dropdown-item"><!----> <a href="/pages/fab2d7/" class="nav-link">STM32</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" class="nav-link">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/db6fb8/" aria-current="page" class="nav-link router-link-exact-active router-link-active">Git备忘清单</a></li><li class="dropdown-item"><!----> <a href="/pages/e1081f/" class="nav-link">Git 创建删除远程分支</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/1ab9a6/" class="nav-link">Shell 脚本学习笔记</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/907786/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/a2d21e/" class="nav-link">kylinV10-SP1 安装 QT</a></li><li class="dropdown-item"><!----> <a href="/pages/b561cf/" class="nav-link">高并发内存池</a></li><li class="dropdown-item"><!----> <a href="/pages/6ab6d1/" class="nav-link">USBGUARD 项目编译环境配置</a></li><li class="dropdown-item"><!----> <a href="/pages/883f02/" class="nav-link">Power_Destory 项目</a></li><li class="dropdown-item"><!----> <a href="/pages/479472/" class="nav-link">U 盘清除工具编译教程</a></li><li class="dropdown-item"><!----> <a href="/pages/9c4241/" class="nav-link">个人博客代码推送教程</a></li><li class="dropdown-item"><!----> <a href="/pages/3ad765/" class="nav-link">SVN Trunk Branches的Merge操作</a></li><li class="dropdown-item"><!----> <a href="/pages/0c0ca8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="MFC" class="dropdown-title"><!----> <span class="title" style="display:;">MFC</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/a4b108/" class="nav-link">MFC编程随记</a></li><li class="dropdown-item"><!----> <a href="/pages/41acbd/" class="nav-link">MFC实现ini配置文件的读取</a></li><li class="dropdown-item"><!----> <a href="/pages/951a7a/" class="nav-link">MFC实现点击列表头排序</a></li><li class="dropdown-item"><!----> <a href="/pages/a8598f/" class="nav-link">贴图法美化Button按钮</a></li><li class="dropdown-item"><!----> <a href="/pages/054516/" class="nav-link">MFC使用细节</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="闪存" class="dropdown-title"><!----> <span class="title" style="display:;">闪存</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/b925b8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li><li class="dropdown-item"><!----> <a href="/pages/28ec23/" class="nav-link">NAND Flash</a></li><li class="dropdown-item"><!----> <a href="/pages/62bf40/" class="nav-link">ARM 处理器</a></li><li class="dropdown-item"><!----> <a href="/pages/1a9374/" class="nav-link">嵌入式基础知识-存储器</a></li><li class="dropdown-item"><!----> <a href="/pages/aac5e3/" class="nav-link">闪存存储和制造技术概述</a></li><li class="dropdown-item"><!----> <a href="/pages/8f6056/" class="nav-link">芯片IO驱动力</a></li><li class="dropdown-item"><!----> <a href="/pages/d146b8/" class="nav-link">主流先进封装技术介绍</a></li><li class="dropdown-item"><!----> <a href="/pages/16f0ba/" class="nav-link">NAND Flash基础</a></li><li class="dropdown-item"><!----> <a href="/pages/90d8d0/" class="nav-link">基于PA算法的FTL引导</a></li><li class="dropdown-item"><!----> <a href="/pages/eb672b/" class="nav-link">SD逻辑擦除和物理擦除</a></li><li class="dropdown-item"><!----> <a href="/pages/747121/" class="nav-link">NAND Flash的SDR、ONFI、DDR接口</a></li><li class="dropdown-item"><!----> <a href="/pages/1eb351/" class="nav-link">【详解】Nand Flash必看知识</a></li><li class="dropdown-item"><!----> <a href="/pages/d2512a/" class="nav-link">【两万字详解】Nand Flash必看知识</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li><li class="dropdown-item"><!----> <a href="/pages/c7c01f/" class="nav-link">完美世界秋招 C++ 游戏开发面经(Cpp部分)</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><a href="/pages/71f6ae/" class="sidebar-link">Git知识总结</a></li><li><a href="/pages/777b8a/" class="sidebar-link">nvm使用小结</a></li><li><a href="/pages/e472d1/" class="sidebar-link">随笔（持续更新）</a></li><li><a href="/pages/ee770e/" class="sidebar-link">虚拟机固定ip地址</a></li><li><a href="/pages/411aa4/" class="sidebar-link">VScode 插件 CodeGeex 使用教程</a></li><li><a href="/pages/0d525d/" class="sidebar-link">KylinV10 将项目上传至 Github</a></li><li><a href="/pages/907786/" class="sidebar-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li><a href="/pages/9c4241/" class="sidebar-link">个人博客代码推送教程</a></li><li><a href="/pages/a2d21e/" class="sidebar-link">kylinV10-SP1 安装 QT</a></li><li><a href="/pages/b561cf/" class="sidebar-link">高并发内存池</a></li><li><a href="/pages/6ab6d1/" class="sidebar-link">USBGUARD项目编译环境配置</a></li><li><a href="/pages/1ab9a6/" class="sidebar-link">Shell 脚本学习笔记</a></li><li><a href="/pages/db6fb8/" aria-current="page" class="active sidebar-link">Git 备忘清单</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/pages/db6fb8/#_1-入门" class="sidebar-link">1. 入门</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-1-创建存储库" class="sidebar-link">1.1 创建存储库</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-2-做出改变" class="sidebar-link">1.2 做出改变</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-3-配置" class="sidebar-link">1.3 配置</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-4-使用分支" class="sidebar-link">1.4 使用分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-5-临时提交" class="sidebar-link">1.5 临时提交</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-6-观察你的存储库" class="sidebar-link">1.6 观察你的存储库</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-7-忽略文件-gitignore" class="sidebar-link">1.7 忽略文件 .gitignore</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-8-重构文件名" class="sidebar-link">1.8 重构文件名</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-9-同步" class="sidebar-link">1.9 同步</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-10-远程" class="sidebar-link">1.10 远程</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-11-跟踪路径更改" class="sidebar-link">1.11 跟踪路径更改</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-12-gitattributes" class="sidebar-link">1.12 .gitattributes</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_1-13-git-配置-ssh-代理" class="sidebar-link">1.13 git 配置 ssh 代理</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/db6fb8/#_2-commit" class="sidebar-link">2. Commit</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-1-改写历史" class="sidebar-link">2.1 改写历史</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-2-在-commit-log-中显示-gpg-签名" class="sidebar-link">2.2 在 commit log 中显示 GPG 签名</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-3-修改远程-commit-记录" class="sidebar-link">2.3 修改远程 Commit 记录</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-4-commit" class="sidebar-link">2.4 Commit</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-5-撤销远程记录" class="sidebar-link">2.5 撤销远程记录</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-6-放弃本地修改内容" class="sidebar-link">2.6 放弃本地修改内容</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-7-把-a-分支的某一个-commit-放到-b-分支上" class="sidebar-link">2.7 把 A 分支的某一个 commit，放到 B 分支上</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-8-重设第一个-commit" class="sidebar-link">2.8 重设第一个 commit</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-9-回到远程仓库的状态" class="sidebar-link">2.9 回到远程仓库的状态</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-10-commit-历史中显示-branch1-有的但是-branch2-没有-commit" class="sidebar-link">2.10 commit 历史中显示 Branch1 有的但是 Branch2 没有 commit</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_2-11-git-迁移" class="sidebar-link">2.11 git 迁移</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/db6fb8/#_3-git-submodule-子模块" class="sidebar-link">3. Git Submodule 子模块</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-1-添加子模块" class="sidebar-link">3.1  添加子模块</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-2-克隆包含子模块的仓库" class="sidebar-link">3.2 克隆包含子模块的仓库</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-3-更新子模块" class="sidebar-link">3.3 更新子模块</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-4-切换到子模块的特定提交" class="sidebar-link">3.4 切换到子模块的特定提交</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-5-查看当前仓库中的子模块" class="sidebar-link">3.5 查看当前仓库中的子模块</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-6-初始化子模块" class="sidebar-link">3.6 初始化子模块</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-7-切换到父仓库的特定提交-并更新子模块" class="sidebar-link">3.7 切换到父仓库的特定提交，并更新子模块</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-8-获取并切换子模块的最新标签" class="sidebar-link">3.8 获取并切换子模块的最新标签</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-9-子模块递归" class="sidebar-link">3.9 子模块递归</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-10-获取子模块的最新提交" class="sidebar-link">3.10 获取子模块的最新提交</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-11-删除子模块" class="sidebar-link">3.11 删除子模块</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-12-切换子模块的分支" class="sidebar-link">3.12 切换子模块的分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-13-初始化并更新所有子模块" class="sidebar-link">3.13 初始化并更新所有子模块</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_3-14-切换子模块的特定标签" class="sidebar-link">3.14 切换子模块的特定标签</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/db6fb8/#_4-config-设置" class="sidebar-link">4. Config 设置</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_4-1-查看配置的信息" class="sidebar-link">4.1 查看配置的信息</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_4-2-忽略文件的权限变化" class="sidebar-link">4.2 忽略文件的权限变化</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_4-3-配置自动换行" class="sidebar-link">4.3 配置自动换行</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_4-4-获取帮助信息" class="sidebar-link">4.4 获取帮助信息</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_4-5-中文乱码的解决方案" class="sidebar-link">4.5 中文乱码的解决方案</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_4-6-删除全局设置" class="sidebar-link">4.6 删除全局设置</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_4-7-配置-http-和-socks-代理" class="sidebar-link">4.7 配置 http 和 socks 代理</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_4-8-git-别名" class="sidebar-link">4.8 Git 别名</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_4-9-设置大小写敏感" class="sidebar-link">4.9 设置大小写敏感</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/db6fb8/#_5-git-技巧" class="sidebar-link">5. Git 技巧</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-1-重命名分支" class="sidebar-link">5.1 重命名分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-2-log" class="sidebar-link">5.2 Log</a></li><li class="sidebar-sub-header level4"><a href="/pages/db6fb8/#_5-2-1-按内容搜索更改" class="sidebar-link">5.2.1 按内容搜索更改</a></li><li class="sidebar-sub-header level4"><a href="/pages/db6fb8/#_5-2-2-显示特定文件随时间的变化" class="sidebar-link">5.2.2 显示特定文件随时间的变化</a></li><li class="sidebar-sub-header level4"><a href="/pages/db6fb8/#_5-2-3-打印出很酷的日志可视化" class="sidebar-link">5.2.3 打印出很酷的日志可视化</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-3-分支" class="sidebar-link">5.3 分支</a></li><li class="sidebar-sub-header level4"><a href="/pages/db6fb8/#_5-3-1-列出所有分支及其上游" class="sidebar-link">5.3.1 列出所有分支及其上游</a></li><li class="sidebar-sub-header level4"><a href="/pages/db6fb8/#_5-3-2-快速切换到上一个分支" class="sidebar-link">5.3.2 快速切换到上一个分支</a></li><li class="sidebar-sub-header level4"><a href="/pages/db6fb8/#_5-3-3-只获取所有远程分支" class="sidebar-link">5.3.3 只获取所有远程分支</a></li><li class="sidebar-sub-header level4"><a href="/pages/db6fb8/#_5-3-4-从另一个分支签出单个文件" class="sidebar-link">5.3.4 从另一个分支签出单个文件</a></li><li class="sidebar-sub-header level4"><a href="/pages/db6fb8/#_5-3-5-删除本地存在远程不存在的分支" class="sidebar-link">5.3.5 删除本地存在远程不存在的分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-4-获取最近一次提交的-hash" class="sidebar-link">5.4 获取最近一次提交的 Hash</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-5-删除已经合并到-master-的分支" class="sidebar-link">5.5 删除已经合并到 master 的分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-6-查看冲突文件列表" class="sidebar-link">5.6 查看冲突文件列表</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-7-展示工作区的冲突文件列表" class="sidebar-link">5.7 展示工作区的冲突文件列表</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-8-展示暂存区和最近版本的不同" class="sidebar-link">5.8 展示暂存区和最近版本的不同</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-9-展示暂存区、工作区和最近版本的不同" class="sidebar-link">5.9 展示暂存区、工作区和最近版本的不同</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-10-删除已经合并到-master-的分支" class="sidebar-link">5.10 删除已经合并到 master 的分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-11-关联远程分支" class="sidebar-link">5.11 关联远程分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-12-查看远程分支和本地分支的对应关系" class="sidebar-link">5.12 查看远程分支和本地分支的对应关系</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-13-展示当前分支的最近的-tag" class="sidebar-link">5.13 展示当前分支的最近的 tag</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-14-修改作者名" class="sidebar-link">5.14 修改作者名</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-15-增加远程仓库" class="sidebar-link">5.15 增加远程仓库</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-16-列出所有远程仓库" class="sidebar-link">5.16 列出所有远程仓库</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-17-从-stash-中拿出某个文件的修改" class="sidebar-link">5.17 从 stash 中拿出某个文件的修改</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-18-展示所有-tracked-的文件" class="sidebar-link">5.18 展示所有 tracked 的文件</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-19-展示所有-untracked-的文件" class="sidebar-link">5.19 展示所有 untracked 的文件</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-20-展示所有忽略的文件" class="sidebar-link">5.20 展示所有忽略的文件</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-21-把某一个分支导出成一个文件" class="sidebar-link">5.21 把某一个分支导出成一个文件</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-22-从包中导入分支" class="sidebar-link">5.22 从包中导入分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-23-执行-rebase-之前自动-stash" class="sidebar-link">5.23 执行 rebase 之前自动 stash</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-24-从远程仓库根据-id-拉下某一状态-到本地分支" class="sidebar-link">5.24 从远程仓库根据 ID，拉下某一状态，到本地分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-25-详细展示一行中的修改" class="sidebar-link">5.25 详细展示一行中的修改</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-26-清除-gitignore-文件中记录的文件" class="sidebar-link">5.26 清除 gitignore 文件中记录的文件</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-27-展示忽略的文件" class="sidebar-link">5.27 展示忽略的文件</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-28-新建并切换到新分支上-同时这个分支没有任何-commit" class="sidebar-link">5.28 新建并切换到新分支上，同时这个分支没有任何 commit</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-29-展示任意分支某一文件的内容" class="sidebar-link">5.29 展示任意分支某一文件的内容</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-30-clone-最新一次提交" class="sidebar-link">5.30 clone 最新一次提交</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-31-忽略某个文件的改动" class="sidebar-link">5.31 忽略某个文件的改动</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-32-以最后提交的顺序列出所有-git-分支" class="sidebar-link">5.32 以最后提交的顺序列出所有 Git 分支</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-33-把暂存区的指定-file-放到工作区中" class="sidebar-link">5.33 把暂存区的指定 file 放到工作区中</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-34-配置-ssh-协议代理" class="sidebar-link">5.34 配置 SSH 协议代理</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_5-35-fork仓库同步上游仓库" class="sidebar-link">5.35 Fork仓库同步上游仓库</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/db6fb8/#_6-统计查询" class="sidebar-link">6. 统计查询</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-1-查看-git-上的个人代码量" class="sidebar-link">6.1 查看 git 上的个人代码量</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-2-统计每个人增删行数" class="sidebar-link">6.2 统计每个人增删行数</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-3-查看仓库提交者排名" class="sidebar-link">6.3 查看仓库提交者排名</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-4-提交数统计" class="sidebar-link">6.4 提交数统计</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-5-查看某段代码是谁写的" class="sidebar-link">6.5 查看某段代码是谁写的</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-5-查看两个星期内的改动" class="sidebar-link">6.5 查看两个星期内的改动</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-6-在-commit-log-中查找相关内容" class="sidebar-link">6.6 在 commit log 中查找相关内容</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-7-git-仓库的大小" class="sidebar-link">6.7 Git 仓库的大小</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-8-git-仓库的总大小" class="sidebar-link">6.8 Git 仓库的总大小</a></li><li class="sidebar-sub-header level3"><a href="/pages/db6fb8/#_6-9-查询历史体积大的-10-个文件" class="sidebar-link">6.9 查询历史体积大的 10 个文件</a></li></ul></li></ul></li><li><a href="/pages/883f02/" class="sidebar-link">Power_Destory 项目</a></li><li><a href="/pages/479472/" class="sidebar-link">U盘清除工具编译教程</a></li><li><a href="/pages/e1081f/" class="sidebar-link">Git 创建删除远程分支</a></li><li><a href="/pages/3ad765/" class="sidebar-link">SVN Trunk Branches的Merge操作</a></li><li><a href="/pages/0c0ca8/" class="sidebar-link">如何高效阅读嵌入式项目代码</a></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-06225672><div class="articleInfo" data-v-06225672><ul class="breadcrumbs" data-v-06225672><li data-v-06225672><a href="/" title="首页" class="iconfont icon-home router-link-active" data-v-06225672></a></li> <li data-v-06225672><span data-v-06225672>开发日常</span></li></ul> <div class="info" data-v-06225672><div title="作者" class="author iconfont icon-touxiang" data-v-06225672><a href="javascript:;" data-v-06225672>霜晨月</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-06225672><a href="javascript:;" data-v-06225672>2024-02-22</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="">Git 备忘清单<!----></h1> <!----> <div class="theme-vdoing-content content__default"><h1 id="git-备忘清单"><a href="#git-备忘清单" class="header-anchor">#</a> Git 备忘清单</h1> <h2 id="_1-入门"><a href="#_1-入门" class="header-anchor">#</a> 1. 入门</h2> <h3 id="_1-1-创建存储库"><a href="#_1-1-创建存储库" class="header-anchor">#</a> 1.1 创建存储库</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 创建一个新的本地存储库</span>
<span class="token function">git</span> init <span class="token punctuation">[</span>项目名称<span class="token punctuation">]</span>

<span class="token comment"># 克隆存储库(代码仓库)</span>
<span class="token function">git</span> clone <span class="token operator">&lt;</span>git_url<span class="token operator">&gt;</span>

<span class="token comment"># 将存储库克隆到指定目录</span>
<span class="token function">git</span> clone <span class="token operator">&lt;</span>git_url<span class="token operator">&gt;</span> 指定目录

<span class="token comment"># 将存储库克隆到指定目录，并指定分支</span>
<span class="token function">git</span> clone <span class="token operator">&lt;</span>git_url<span class="token operator">&gt;</span> <span class="token parameter variable">-b</span> <span class="token operator">&lt;</span>分支名称<span class="token operator">&gt;</span> 指定目录
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br></div></div><h3 id="_1-2-做出改变"><a href="#_1-2-做出改变" class="header-anchor">#</a> 1.2 做出改变</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 在工作目录中显示修改后的文件，为您的下一次提交暂存</span>
<span class="token function">git</span> status

<span class="token comment"># 暂存文件，准备提交</span>
<span class="token function">git</span> <span class="token function">add</span> <span class="token punctuation">[</span>file<span class="token punctuation">]</span>

<span class="token comment"># 暂存所有更改的文件，准备提交</span>
<span class="token function">git</span> <span class="token function">add</span> <span class="token builtin class-name">.</span>

<span class="token comment"># 将所有暂存文件提交到版本化历史记录</span>
<span class="token function">git</span> commit <span class="token parameter variable">-m</span> <span class="token string">&quot;commit message&quot;</span>

<span class="token comment"># 将所有跟踪的文件提交到版本化历史记录</span>
<span class="token function">git</span> commit <span class="token parameter variable">-am</span> <span class="token string">&quot;commit message&quot;</span>

<span class="token comment"># 取消暂存文件，保留文件更改</span>
<span class="token function">git</span> reset <span class="token punctuation">[</span>file<span class="token punctuation">]</span>

<span class="token comment"># 将所有内容恢复到最后一次提交</span>
<span class="token function">git</span> reset <span class="token parameter variable">--hard</span>

<span class="token comment"># 已更改但未暂存内容的差异</span>
<span class="token function">git</span> <span class="token function">diff</span>

<span class="token comment"># 已 commited 但尚未提交的内容的差异</span>
<span class="token function">git</span> <span class="token function">diff</span> <span class="token parameter variable">--staged</span>

<span class="token comment"># 在指定分支之前应用当前分支的任何提交</span>
<span class="token function">git</span> rebase <span class="token punctuation">[</span>branch<span class="token punctuation">]</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br></div></div><h3 id="_1-3-配置"><a href="#_1-3-配置" class="header-anchor">#</a> 1.3 配置</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 设置将附加到您的提交和标签的名称</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> user.name <span class="token string">&quot;name&quot;</span>

<span class="token comment"># 设置将附加到您的提交和标签 tags 的电子邮件地址</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> user.email <span class="token string">&quot;email&quot;</span>

<span class="token comment"># 启用 Git 输出的一些着色</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> color.ui auto

<span class="token comment"># 在文本编辑器中编辑全局配置文件</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> <span class="token parameter variable">--edit</span>

<span class="token comment"># 显示本地 repo 配置设置</span>
<span class="token function">git</span> config <span class="token parameter variable">--list</span>

<span class="token comment"># 删除全局设置</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> <span class="token parameter variable">--unset</span> <span class="token operator">&lt;</span>entry-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br></div></div><h3 id="_1-4-使用分支"><a href="#_1-4-使用分支" class="header-anchor">#</a> 1.4 使用分支</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 列出所有本地分支</span>
<span class="token function">git</span> branch

<span class="token comment"># 列出所有分支，本地和远程</span>
<span class="token function">git</span> branch <span class="token parameter variable">-av</span>

<span class="token comment"># 切换到 my_branch，并更新工作目录</span>
<span class="token function">git</span> checkout my_branch

<span class="token comment"># 创建并切换到新分支new_branch</span>
<span class="token function">git</span> checkout <span class="token parameter variable">-b</span> new_branch

<span class="token comment"># 删除名为 my_branch 的分支</span>
<span class="token function">git</span> branch <span class="token parameter variable">-d</span> my_branch

<span class="token comment"># 将分支 A 合并到分支 B</span>
<span class="token function">git</span> checkout branchB
<span class="token function">git</span> merge branchA

<span class="token comment"># 标记当前提交</span>
<span class="token function">git</span> tag my_tag

<span class="token comment"># 从远程分支中创建并切换到本地分支</span>
<span class="token function">git</span> checkout <span class="token parameter variable">-b</span> <span class="token operator">&lt;</span>branch-name<span class="token operator">&gt;</span> origin/<span class="token operator">&lt;</span>branch-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br></div></div><h3 id="_1-5-临时提交"><a href="#_1-5-临时提交" class="header-anchor">#</a> 1.5 临时提交</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 保存已修改和分阶段的更改</span>
<span class="token function">git</span> stash

<span class="token comment"># 列出隐藏文件更改的堆栈顺序</span>
<span class="token function">git</span> stash list

<span class="token comment"># 从存储堆栈顶部编写工作</span>
<span class="token function">git</span> stash pop

<span class="token comment"># 丢弃存储堆栈顶部的更改</span>
<span class="token function">git</span> stash drop

<span class="token comment"># 回到某个 stash 的状态</span>
<span class="token function">git</span> stash apply <span class="token operator">&lt;</span>stash@<span class="token punctuation">{</span>n<span class="token punctuation">}</span><span class="token operator">&gt;</span>

<span class="token comment"># 删除所有的 stash</span>
<span class="token function">git</span> stash <span class="token function">clear</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br></div></div><h3 id="_1-6-观察你的存储库"><a href="#_1-6-观察你的存储库" class="header-anchor">#</a> 1.6 观察你的存储库</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 显示当前活动分支的提交历史</span>
<span class="token function">git</span> log

<span class="token comment"># 显示 branchA 上不在 branchB 上的提交</span>
<span class="token function">git</span> log branchB<span class="token punctuation">..</span>branchA

<span class="token comment"># 显示更改文件的提交，即使跨重命名</span>
<span class="token function">git</span> log <span class="token parameter variable">--follow</span> <span class="token punctuation">[</span>file<span class="token punctuation">]</span>

<span class="token comment"># 显示 branchA 中的内容与 branchB 中的内容的差异</span>
<span class="token function">git</span> <span class="token function">diff</span> branchB<span class="token punctuation">..</span>.branchA

<span class="token comment"># 以人类可读的格式显示 Git 中的任何对象</span>
<span class="token function">git</span> show <span class="token punctuation">[</span>SHA<span class="token punctuation">]</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h3 id="_1-7-忽略文件-gitignore"><a href="#_1-7-忽略文件-gitignore" class="header-anchor">#</a> 1.7 忽略文件 .gitignore</h3> <p>文件 <code>.gitignore</code> 指定了 <code>Git</code> 应该忽略的 <strong>未跟踪的</strong> 文件</p> <table><thead><tr><th>行首 <code>#</code></th> <th>全行注释，不支持行尾类注释 <em>(转义 <code>\#</code>)</em></th></tr></thead> <tbody><tr><td>行首 <strong><code>!</code></strong></td> <td>否定模式 <em>(转义 <code>\!</code>)</em></td></tr> <tr><td>**</td> <td>匹配任意路径</td></tr> <tr><td>*</td> <td>匹配任意多个字符</td></tr> <tr><td>?</td> <td>匹配任意一个字符</td></tr> <tr><td>doc/**</td> <td>匹配 <code>doc</code> 文件夹下的全部内容</td></tr> <tr><td>doc/**/a</td> <td>匹配任意深度路径下的 <code>a</code> 文件或文件夹</td></tr> <tr><td>/</td> <td>表示路径分隔符，不区分操作系统</td></tr> <tr><td><code>/</code> 结尾</td> <td>仅会匹配文件夹，否则会匹配文件和文件夹</td></tr> <tr><td>空行</td> <td>不匹配任何文件</td></tr> <tr><td>行尾空格</td> <td>默认被忽略，可使用 <code>\</code> 进行转义</td></tr> <tr><td>行首空格</td> <td>被正常处理，不会被忽略</td></tr></tbody></table> <p>当前 <code>.gitignore</code> 文件定义规则的优先级高于上级路径 <code>.gitignore</code> 定义规则的优先级；后定义的规则优先级高于前面定义规则的优先级</p> <div class="language-basic line-numbers-mode"><pre class="language-basic"><code># 忽略当前目录 logs 文件夹下的全部内容
<span class="token operator">/</span>logs<span class="token operator">/</span>
<span class="token operator">/</span>logs<span class="token operator">/</span><span class="token operator">*</span>
<span class="token operator">/</span>logs<span class="token operator">/</span><span class="token operator">*</span><span class="token operator">*</span>
# 上述几条规则等效

# 忽略 Mac 系统文件，包括任意子路径下的同名文件（夹）
.DS_store

# 忽略 node_modules 文件夹，包括任意子路径下的同名文件夹
node_modules<span class="token operator">/</span>

# 忽略任意子路径下build、target文件夹，
# 但不忽略src<span class="token operator">/</span>main、src<span class="token operator">/</span>test下的build、target文件夹
build<span class="token operator">/</span>
<span class="token comment">!**/src/main/**/build/</span>
<span class="token comment">!**/src/test/**/build/</span>
target<span class="token operator">/</span>
<span class="token comment">!**/src/main/**/target/</span>
<span class="token comment">!**/src/test/**/target/</span>

# 使用 <span class="token comment">! 重新包含指定文件（夹）</span>
<span class="token comment">!logs/.gitkeep</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br></div></div><h3 id="_1-8-重构文件名"><a href="#_1-8-重构文件名" class="header-anchor">#</a> 1.8 重构文件名</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 从工作目录中删除文件并暂存删除</span>
<span class="token function">git</span> <span class="token function">rm</span> <span class="token operator">&lt;</span>filename<span class="token operator">&gt;</span>

<span class="token comment"># 从版本控制中删除文件但在本地保留文件</span>
<span class="token function">git</span> <span class="token function">rm</span> <span class="token parameter variable">--cached</span> <span class="token operator">&lt;</span>filename<span class="token operator">&gt;</span>

<span class="token comment"># 更改文件名并准备提交</span>
<span class="token function">git</span> <span class="token function">mv</span> <span class="token operator">&lt;</span>filename-orig<span class="token operator">&gt;</span> <span class="token operator">&lt;</span>filename-renamed<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h3 id="_1-9-同步"><a href="#_1-9-同步" class="header-anchor">#</a> 1.9 同步</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 从该 Git 远程获取所有分支</span>
<span class="token function">git</span> fetch <span class="token punctuation">[</span>alias<span class="token punctuation">]</span>

<span class="token comment"># 将远程分支合并到当前分支以使其保持最新状态</span>
<span class="token function">git</span> merge <span class="token punctuation">[</span>alias<span class="token punctuation">]</span>/<span class="token punctuation">[</span>branch<span class="token punctuation">]</span>

<span class="token comment"># 没有快进</span>
<span class="token function">git</span> merge --no-ff <span class="token punctuation">[</span>alias<span class="token punctuation">]</span>/<span class="token punctuation">[</span>branch<span class="token punctuation">]</span>

<span class="token comment"># 仅快进</span>
<span class="token function">git</span> merge --ff-only <span class="token punctuation">[</span>alias<span class="token punctuation">]</span>/<span class="token punctuation">[</span>branch<span class="token punctuation">]</span>

<span class="token comment"># 将本地分支提交传输到远程存储库分支</span>
<span class="token function">git</span> push <span class="token punctuation">[</span>alias<span class="token punctuation">]</span> <span class="token punctuation">[</span>branch<span class="token punctuation">]</span>

<span class="token comment"># 从跟踪远程分支获取并合并任何提交</span>
<span class="token function">git</span> pull

<span class="token comment"># 将另一个分支的一个特定提交合并到当前分支</span>
<span class="token function">git</span> cherry-pick <span class="token punctuation">[</span>commit_id<span class="token punctuation">]</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br></div></div><h3 id="_1-10-远程"><a href="#_1-10-远程" class="header-anchor">#</a> 1.10 远程</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 添加一个 git URL 作为别名</span>
<span class="token function">git</span> remote <span class="token function">add</span> <span class="token punctuation">[</span>alias<span class="token punctuation">]</span> <span class="token punctuation">[</span>url<span class="token punctuation">]</span>

<span class="token comment"># 显示您设置的远程存储库的名称</span>
<span class="token function">git</span> remote

<span class="token comment"># 显示远程存储库的名称和 URL</span>
<span class="token function">git</span> remote <span class="token parameter variable">-v</span>

<span class="token comment"># 删除远程存储库</span>
<span class="token function">git</span> remote <span class="token function">rm</span> <span class="token punctuation">[</span>remote repo name<span class="token punctuation">]</span>

<span class="token comment"># 更改 git repo 的 URL</span>
<span class="token function">git</span> remote set-url origin <span class="token punctuation">[</span>git_url<span class="token punctuation">]</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h3 id="_1-11-跟踪路径更改"><a href="#_1-11-跟踪路径更改" class="header-anchor">#</a> 1.11 跟踪路径更改</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 从项目中删除文件并暂存删除以进行提交</span>
<span class="token function">git</span> <span class="token function">rm</span> <span class="token punctuation">[</span>file<span class="token punctuation">]</span>

<span class="token comment"># 更改现有文件路径并暂存移动</span>
<span class="token function">git</span> <span class="token function">mv</span> <span class="token punctuation">[</span>existing-path<span class="token punctuation">]</span> <span class="token punctuation">[</span>new-path<span class="token punctuation">]</span>

<span class="token comment"># 显示所有提交日志，并指示任何移动的路径</span>
<span class="token function">git</span> log <span class="token parameter variable">--stat</span> <span class="token parameter variable">-M</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h3 id="_1-12-gitattributes"><a href="#_1-12-gitattributes" class="header-anchor">#</a> 1.12 .gitattributes</h3> <div class="language-basic line-numbers-mode"><pre class="language-basic"><code># 设置默认行为，以防人们没有设置 core.autocrlf
<span class="token operator">*</span> <span class="token function">text</span><span class="token operator">=</span>auto

# 明确声明您希望始终规范化并在结帐时
# 转换为本机行结尾的文本文件
<span class="token operator">*</span>.c <span class="token function">text</span>
<span class="token operator">*</span>.h <span class="token function">text</span>

# 声明在结帐时始终以 CRLF 行结尾的文件
<span class="token operator">*</span>.sln <span class="token function">text</span> eol<span class="token operator">=</span>crlf

# 表示所有真正二进制且不应修改的文件
<span class="token operator">*</span>.png binary
<span class="token operator">*</span>.jpg binary
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><p><a href="https://github.com/github/linguist/blob/master/docs/overrides.md#using-gitattributes" target="_blank" rel="noopener noreferrer">计入存储库语言<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <div class="language-basic line-numbers-mode"><pre class="language-basic"><code># 标记或取消标记要根据存储库的语言统计数据而
# 忽略或默认隐藏差异的路径
search<span class="token operator">/</span>index.json linguist<span class="token operator">-</span>generated<span class="token operator">=</span>true

# 以下属性统计 SQL 文件
<span class="token operator">*</span>.sql linguist<span class="token operator">-</span>detectable<span class="token operator">=</span>true

# 从统计信息中排除
docs<span class="token operator">/</span>formatter.rb linguist<span class="token operator">-</span>documentation<span class="token operator">=</span>false

# 将它们从统计信息中排除
special<span class="token operator">-</span>vendored<span class="token operator">-</span>path<span class="token operator">/</span><span class="token operator">*</span> linguist<span class="token operator">-</span>vendored

# 将所有 .rb 文件检测为 Java 文件
<span class="token operator">*</span>.rb linguist<span class="token operator">-</span>language<span class="token operator">=</span>Java
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br></div></div><h3 id="_1-13-git-配置-ssh-代理"><a href="#_1-13-git-配置-ssh-代理" class="header-anchor">#</a> 1.13 git 配置 ssh 代理</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>$ <span class="token function">cat</span> ~/.ssh/config
Host gitlab.com
<span class="token comment"># 直接使用 sh**socks 提供的 socks5 代理端口</span>
ProxyCommand <span class="token function">nc</span> <span class="token parameter variable">-X</span> <span class="token number">5</span> <span class="token parameter variable">-x</span> <span class="token number">127.0</span>.0.1:1080 %h %p

Host github.com
ProxyCommand <span class="token function">nc</span> <span class="token parameter variable">-X</span> <span class="token number">5</span> <span class="token parameter variable">-x</span> <span class="token number">127.0</span>.0.1:1080 %h %p
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><h2 id="_2-commit"><a href="#_2-commit" class="header-anchor">#</a> 2. Commit</h2> <h3 id="_2-1-改写历史"><a href="#_2-1-改写历史" class="header-anchor">#</a> 2.1 改写历史</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 重写最后的提交消息</span>
<span class="token function">git</span> commit <span class="token parameter variable">--amend</span> <span class="token parameter variable">-m</span> <span class="token string">&quot;new message&quot;</span>

<span class="token comment"># 修改最新的提交而不更改提交消息</span>
<span class="token function">git</span> commit <span class="token parameter variable">--amend</span> --no-edit
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="_2-2-在-commit-log-中显示-gpg-签名"><a href="#_2-2-在-commit-log-中显示-gpg-签名" class="header-anchor">#</a> 2.2 在 commit log 中显示 GPG 签名</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> log --show-signature
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_2-3-修改远程-commit-记录"><a href="#_2-3-修改远程-commit-记录" class="header-anchor">#</a> 2.3 修改远程 Commit 记录</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> rebase <span class="token parameter variable">-i</span> HEAD~3
<span class="token comment"># 表示要修改当前版本的倒数第三次状态</span>

<span class="token comment"># 将要更改的记录行首单词 pick 改为 edit</span>
pick 96dc3f9 提交 commit 描述内容 <span class="token number">1</span>
pick f1cce8a 提交 commit 描述内容 <span class="token number">2</span>
pick <span class="token number">6293516</span> 提交 commit 描述内容 <span class="token number">3</span>
<span class="token comment"># Rebase eeb03a4..6293516 onto eeb03a4</span>
<span class="token comment">#                     (3 commands)</span>
<span class="token comment">#</span>
<span class="token comment"># Commands:</span>
<span class="token comment"># p, pick = 使用提交</span>
<span class="token comment"># r, reword = 使用提交，但编辑提交消息</span>
<span class="token comment"># e, edit = 使用提交，但停止修改</span>
<span class="token comment"># s, squash = 使用提交，但融合到先前的提交中</span>
<span class="token comment"># f, fixup = 像 squash，但丢弃此提交的日志消息</span>
<span class="token comment"># x, exec = 使用 shell 运行命令(该行的其余部分)</span>
<span class="token comment"># d, drop = 删除提交</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br></div></div><p>保存并退出，会弹出下面提示</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 您现在可以修改提交，使用</span>
<span class="token comment">#</span>
<span class="token comment">#   git commit --amend</span>
<span class="token comment">#</span>
<span class="token comment"># 对更改感到满意后，运行</span>
<span class="token comment">#</span>
<span class="token comment">#   git rebase --continue</span>
<span class="token comment">#</span>
<span class="token comment"># 1. 通过这条命令进入编辑更改 commit，保存退出</span>
<span class="token function">git</span> commit <span class="token parameter variable">--amend</span>
<span class="token comment"># 2. 保存退出确认修改，继续执行下面命令,</span>
<span class="token function">git</span> rebase <span class="token parameter variable">--continue</span>
<span class="token comment"># 如果修改多条记录反复执行上面两条命令直到完成所有修改</span>

<span class="token comment"># 最后，确保没有人提交进行推送，最好不要加 -f 强制推送</span>
<span class="token function">git</span> push <span class="token parameter variable">-f</span> origin master
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br></div></div><h3 id="_2-4-commit"><a href="#_2-4-commit" class="header-anchor">#</a> 2.4 Commit</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 重写最后的提交信息</span>
<span class="token function">git</span> commit <span class="token parameter variable">-v</span> <span class="token parameter variable">--amend</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_2-5-撤销远程记录"><a href="#_2-5-撤销远程记录" class="header-anchor">#</a> 2.5 撤销远程记录</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 撤销一条记录</span>
<span class="token function">git</span> reset <span class="token parameter variable">--hard</span> HEAD~1
<span class="token comment"># 强制同步到远程仓库</span>
<span class="token function">git</span> push <span class="token parameter variable">-f</span> origin HEAD:master
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h3 id="_2-6-放弃本地修改内容"><a href="#_2-6-放弃本地修改内容" class="header-anchor">#</a> 2.6 放弃本地修改内容</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 如果有的修改以及加入暂存区的话</span>
<span class="token function">git</span> reset <span class="token parameter variable">--hard</span>
<span class="token comment"># 还原所有修改，不会删除新增的文件</span>
<span class="token function">git</span> checkout <span class="token builtin class-name">.</span>
<span class="token comment"># 下面命令会删除新增的文件</span>
<span class="token function">git</span> clean <span class="token parameter variable">-xdf</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h3 id="_2-7-把-a-分支的某一个-commit-放到-b-分支上"><a href="#_2-7-把-a-分支的某一个-commit-放到-b-分支上" class="header-anchor">#</a> 2.7 把 A 分支的某一个 commit，放到 B 分支上</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 切换到 B 分支</span>
<span class="token function">git</span> checkout <span class="token operator">&lt;</span>B<span class="token operator">&gt;</span>
<span class="token comment"># 将 A 分支 &lt;hash-id&gt; 的内容 pick 到 B 分支</span>
<span class="token function">git</span> cherry-pick <span class="token operator">&lt;</span>hash-id<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h3 id="_2-8-重设第一个-commit"><a href="#_2-8-重设第一个-commit" class="header-anchor">#</a> 2.8 重设第一个 commit</h3> <p>把所有的改动都重新放回工作区，并<strong>清空所有的 commit</strong>，这样就可以重新提交第一个 <code>commit</code> 了</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> update-ref <span class="token parameter variable">-d</span> HEAD
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_2-9-回到远程仓库的状态"><a href="#_2-9-回到远程仓库的状态" class="header-anchor">#</a> 2.9 回到远程仓库的状态</h3> <p>抛弃本地所有的修改，回到远程仓库的状态</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> fetch <span class="token parameter variable">--all</span> <span class="token operator">&amp;&amp;</span> <span class="token function">git</span> reset <span class="token parameter variable">--hard</span> origin/master
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_2-10-commit-历史中显示-branch1-有的但是-branch2-没有-commit"><a href="#_2-10-commit-历史中显示-branch1-有的但是-branch2-没有-commit" class="header-anchor">#</a> 2.10 commit 历史中显示 Branch1 有的但是 Branch2 没有 commit</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> log Branch1 ^Branch2
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_2-11-git-迁移"><a href="#_2-11-git-迁移" class="header-anchor">#</a> 2.11 git 迁移</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 从原地址克隆一份裸版本库</span>
<span class="token function">git</span> clone <span class="token parameter variable">--bare</span> https://github.com/username/project.git

<span class="token comment"># 然后新建一个地址，比如一下</span>
https://gitee.com/username/newproject.git

<span class="token comment"># 进入project.git这个全裸版本库，以镜像推送的方式上传代码到newproject上。</span>
<span class="token builtin class-name">cd</span> project.git
<span class="token function">git</span> push <span class="token parameter variable">--mirror</span> https://gitee.com/username/newproject.git

<span class="token comment"># 使用新地址，直接 Clone 到本地就可以了。</span>
$ <span class="token function">git</span> clone https://gitee.com/username/newproject.git
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h2 id="_3-git-submodule-子模块"><a href="#_3-git-submodule-子模块" class="header-anchor">#</a> 3. Git Submodule 子模块</h2> <h3 id="_3-1-添加子模块"><a href="#_3-1-添加子模块" class="header-anchor">#</a> 3.1  添加子模块</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> submodule <span class="token function">add</span> <span class="token operator">&lt;</span>仓库地址<span class="token operator">&gt;</span> <span class="token operator">&lt;</span>子模块路径<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_3-2-克隆包含子模块的仓库"><a href="#_3-2-克隆包含子模块的仓库" class="header-anchor">#</a> 3.2 克隆包含子模块的仓库</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> clone <span class="token operator">&lt;</span>repository_url<span class="token operator">&gt;</span> <span class="token parameter variable">--recursive</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_3-3-更新子模块"><a href="#_3-3-更新子模块" class="header-anchor">#</a> 3.3 更新子模块</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> submodule update <span class="token parameter variable">--remote</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_3-4-切换到子模块的特定提交"><a href="#_3-4-切换到子模块的特定提交" class="header-anchor">#</a> 3.4 切换到子模块的特定提交</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token builtin class-name">cd</span> <span class="token operator">&lt;</span>path_to_submodule<span class="token operator">&gt;</span>
<span class="token function">git</span> checkout <span class="token operator">&lt;</span>commit_hash<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_3-5-查看当前仓库中的子模块"><a href="#_3-5-查看当前仓库中的子模块" class="header-anchor">#</a> 3.5 查看当前仓库中的子模块</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> submodule status
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_3-6-初始化子模块"><a href="#_3-6-初始化子模块" class="header-anchor">#</a> 3.6 初始化子模块</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> submodule init
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_3-7-切换到父仓库的特定提交-并更新子模块"><a href="#_3-7-切换到父仓库的特定提交-并更新子模块" class="header-anchor">#</a> 3.7 切换到父仓库的特定提交，并更新子模块</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token builtin class-name">cd</span> <span class="token punctuation">..</span>
<span class="token function">git</span> checkout <span class="token operator">&lt;</span>commit_hash<span class="token operator">&gt;</span>
<span class="token function">git</span> submodule update <span class="token parameter variable">--remote</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h3 id="_3-8-获取并切换子模块的最新标签"><a href="#_3-8-获取并切换子模块的最新标签" class="header-anchor">#</a> 3.8 获取并切换子模块的最新标签</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token builtin class-name">cd</span> <span class="token operator">&lt;</span>path_to_submodule<span class="token operator">&gt;</span>
<span class="token function">git</span> fetch <span class="token parameter variable">--tags</span>
<span class="token function">git</span> checkout <span class="token variable"><span class="token variable">$(</span><span class="token function">git</span> describe <span class="token parameter variable">--tags</span> <span class="token punctuation">$(</span>git rev-list <span class="token parameter variable">--tags</span> --max-count<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token variable">)</span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h3 id="_3-9-子模块递归"><a href="#_3-9-子模块递归" class="header-anchor">#</a> 3.9 子模块递归</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 添加所有已存在的子模块</span>
<span class="token function">git</span> submodule foreach <span class="token parameter variable">--recursive</span> <span class="token function">git</span> submodule <span class="token function">add</span> <span class="token operator">&lt;</span>repository_url<span class="token operator">&gt;</span>
<span class="token comment"># 更新所有子模块到最新提交</span>
<span class="token function">git</span> submodule foreach <span class="token parameter variable">--recursive</span> <span class="token function">git</span> pull origin master
<span class="token comment"># 检出特定的子模块路径</span>
<span class="token function">git</span> submodule foreach <span class="token parameter variable">--recursive</span> <span class="token function">git</span> checkout <span class="token operator">&lt;</span>branch_name<span class="token operator">&gt;</span>
<span class="token comment"># 获取仓库中的所有子模块变化</span>
<span class="token function">git</span> submodule foreach <span class="token parameter variable">--recursive</span> <span class="token function">git</span> fetch
<span class="token comment"># 获取并合并子模块的远程分支</span>
<span class="token function">git</span> submodule foreach <span class="token parameter variable">--recursive</span> <span class="token function">git</span> pull origin <span class="token operator">&lt;</span>branch_name<span class="token operator">&gt;</span>
<span class="token comment"># 将子模块还原到父仓库中的初始提交</span>
<span class="token function">git</span> submodule foreach <span class="token parameter variable">--recursive</span> <span class="token function">git</span> checkout <span class="token builtin class-name">.</span>
<span class="token comment"># 获取子模块的更新并忽略本地修改</span>
<span class="token function">git</span> submodule foreach <span class="token parameter variable">--recursive</span> <span class="token function">git</span> fetch <span class="token parameter variable">--all</span>
<span class="token function">git</span> submodule foreach <span class="token parameter variable">--recursive</span> <span class="token function">git</span> reset <span class="token parameter variable">--hard</span> origin/master
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br></div></div><h3 id="_3-10-获取子模块的最新提交"><a href="#_3-10-获取子模块的最新提交" class="header-anchor">#</a> 3.10 获取子模块的最新提交</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token builtin class-name">cd</span> <span class="token operator">&lt;</span>path_to_submodule<span class="token operator">&gt;</span>
<span class="token function">git</span> pull
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_3-11-删除子模块"><a href="#_3-11-删除子模块" class="header-anchor">#</a> 3.11 删除子模块</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> submodule deinit <span class="token operator">&lt;</span>path_to_submodule<span class="token operator">&gt;</span>
<span class="token function">git</span> <span class="token function">rm</span> <span class="token operator">&lt;</span>path_to_submodule<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_3-12-切换子模块的分支"><a href="#_3-12-切换子模块的分支" class="header-anchor">#</a> 3.12 切换子模块的分支</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token builtin class-name">cd</span> <span class="token operator">&lt;</span>path_to_submodule<span class="token operator">&gt;</span>
<span class="token function">git</span> checkout <span class="token operator">&lt;</span>branch_name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_3-13-初始化并更新所有子模块"><a href="#_3-13-初始化并更新所有子模块" class="header-anchor">#</a> 3.13 初始化并更新所有子模块</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> submodule init
<span class="token function">git</span> submodule update
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_3-14-切换子模块的特定标签"><a href="#_3-14-切换子模块的特定标签" class="header-anchor">#</a> 3.14 切换子模块的特定标签</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token builtin class-name">cd</span> <span class="token operator">&lt;</span>path_to_submodule<span class="token operator">&gt;</span>
<span class="token function">git</span> checkout tags/<span class="token operator">&lt;</span>tag_name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h2 id="_4-config-设置"><a href="#_4-config-设置" class="header-anchor">#</a> 4. Config 设置</h2> <h3 id="_4-1-查看配置的信息"><a href="#_4-1-查看配置的信息" class="header-anchor">#</a> 4.1 查看配置的信息</h3> <p>获取帮助信息，查看修改个人信息的参数</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> <span class="token builtin class-name">help</span> config
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_4-2-忽略文件的权限变化"><a href="#_4-2-忽略文件的权限变化" class="header-anchor">#</a> 4.2 忽略文件的权限变化</h3> <p>不再将文件的权限变化视作改动</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> config core.fileMode <span class="token boolean">false</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_4-3-配置自动换行"><a href="#_4-3-配置自动换行" class="header-anchor">#</a> 4.3 配置自动换行</h3> <p>自动转换坑太大，提交到git是自动将换行符转换为 <code>lf</code></p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> config <span class="token parameter variable">--global</span> core.autocrlf input
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_4-4-获取帮助信息"><a href="#_4-4-获取帮助信息" class="header-anchor">#</a> 4.4 获取帮助信息</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> config <span class="token parameter variable">--list</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_4-5-中文乱码的解决方案"><a href="#_4-5-中文乱码的解决方案" class="header-anchor">#</a> 4.5 中文乱码的解决方案</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> config <span class="token parameter variable">--global</span> core.quotepath <span class="token boolean">false</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_4-6-删除全局设置"><a href="#_4-6-删除全局设置" class="header-anchor">#</a> 4.6 删除全局设置</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> config <span class="token parameter variable">--global</span> <span class="token parameter variable">--unset</span> <span class="token operator">&lt;</span>entry-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_4-7-配置-http-和-socks-代理"><a href="#_4-7-配置-http-和-socks-代理" class="header-anchor">#</a> 4.7 配置 http 和 socks 代理</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 查看代理</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> http.proxy
<span class="token function">git</span> config <span class="token parameter variable">--global</span> https.proxy
<span class="token function">git</span> config <span class="token parameter variable">--global</span> socks.proxy

<span class="token comment"># 设置代理</span>
<span class="token comment"># 适用于 privoxy 将 socks 协议转为 http 协议的 http 端口</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> http.proxy http://127.0.0.1:1080
<span class="token function">git</span> config <span class="token parameter variable">--global</span> https.proxy http://127.0.0.1:1080
<span class="token function">git</span> config <span class="token parameter variable">--global</span> socks.proxy <span class="token number">127.0</span>.0.1:1080

<span class="token comment"># 取消代理</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> <span class="token parameter variable">--unset</span> http.proxy
<span class="token function">git</span> config <span class="token parameter variable">--global</span> <span class="token parameter variable">--unset</span> https.proxy
<span class="token function">git</span> config <span class="token parameter variable">--global</span> <span class="token parameter variable">--unset</span> socks.proxy

<span class="token comment"># 只对 github.com 设置代理</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> http.https://github.com.proxy socks5://127.0.0.1:1080
<span class="token function">git</span> config <span class="token parameter variable">--global</span> https.https://github.com.proxy socks5://127.0.0.1:1080

<span class="token comment"># 取消 github.com 代理</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> <span class="token parameter variable">--unset</span> http.https://github.com.proxy
<span class="token function">git</span> config <span class="token parameter variable">--global</span> <span class="token parameter variable">--unset</span> https.https://github.com.proxy
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br></div></div><h3 id="_4-8-git-别名"><a href="#_4-8-git-别名" class="header-anchor">#</a> 4.8 Git 别名</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> config <span class="token parameter variable">--global</span> alias.co checkout
<span class="token function">git</span> config <span class="token parameter variable">--global</span> alias.br branch
<span class="token function">git</span> config <span class="token parameter variable">--global</span> alias.ci commit
<span class="token function">git</span> config <span class="token parameter variable">--global</span> alias.st status
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p>配置好后，再输入 <code>git</code> 命令的时候就不用再输入一大段了，例如我们要查看状态，只需：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> st
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_4-9-设置大小写敏感"><a href="#_4-9-设置大小写敏感" class="header-anchor">#</a> 4.9 设置大小写敏感</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 查看git 的设置</span>
<span class="token function">git</span> config <span class="token parameter variable">--get</span> core.ignorecase
<span class="token comment"># 设置大小写敏感</span>
<span class="token function">git</span> config core.ignorecase <span class="token boolean">false</span>
<span class="token comment"># 远程有俩相同目录，通过这种方式清除掉，然后提交记录</span>
<span class="token function">git</span> <span class="token function">rm</span> <span class="token parameter variable">-r</span> <span class="token parameter variable">--cached</span> <span class="token operator">&lt;</span>目录/文件<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h2 id="_5-git-技巧"><a href="#_5-git-技巧" class="header-anchor">#</a> 5. Git 技巧</h2> <h3 id="_5-1-重命名分支"><a href="#_5-1-重命名分支" class="header-anchor">#</a> 5.1 重命名分支</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 重命名为new</span>
<span class="token function">git</span> branch <span class="token parameter variable">-m</span> <span class="token operator">&lt;</span>new<span class="token operator">&gt;</span>
<span class="token function">git</span> branch <span class="token parameter variable">-m</span> <span class="token operator">&lt;</span>old<span class="token operator">&gt;</span> <span class="token operator">&lt;</span>new<span class="token operator">&gt;</span> <span class="token comment">#重命名分支</span>

<span class="token comment"># 推送并重置</span>
<span class="token function">git</span> push origin <span class="token parameter variable">-u</span> <span class="token operator">&lt;</span>new<span class="token operator">&gt;</span>

<span class="token comment"># 删除远程分支</span>
<span class="token function">git</span> push origin <span class="token parameter variable">--delete</span> <span class="token operator">&lt;</span>old<span class="token operator">&gt;</span> <span class="token comment">#方法1</span>
<span class="token function">git</span> push origin :oldBranchName <span class="token comment">#方法2</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><h3 id="_5-2-log"><a href="#_5-2-log" class="header-anchor">#</a> 5.2 Log</h3> <h4 id="_5-2-1-按内容搜索更改"><a href="#_5-2-1-按内容搜索更改" class="header-anchor">#</a> 5.2.1 按内容搜索更改</h4> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> log -S<span class="token string">'&lt;a term in the source&gt;'</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h4 id="_5-2-2-显示特定文件随时间的变化"><a href="#_5-2-2-显示特定文件随时间的变化" class="header-anchor">#</a> 5.2.2 显示特定文件随时间的变化</h4> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> log <span class="token parameter variable">-p</span> <span class="token operator">&lt;</span>file_name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h4 id="_5-2-3-打印出很酷的日志可视化"><a href="#_5-2-3-打印出很酷的日志可视化" class="header-anchor">#</a> 5.2.3 打印出很酷的日志可视化</h4> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> log <span class="token parameter variable">--pretty</span><span class="token operator">=</span>oneline <span class="token parameter variable">--graph</span> <span class="token parameter variable">--decorate</span> <span class="token parameter variable">--all</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-3-分支"><a href="#_5-3-分支" class="header-anchor">#</a> 5.3 分支</h3> <h4 id="_5-3-1-列出所有分支及其上游"><a href="#_5-3-1-列出所有分支及其上游" class="header-anchor">#</a> 5.3.1 列出所有分支及其上游</h4> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> branch <span class="token parameter variable">-vv</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h4 id="_5-3-2-快速切换到上一个分支"><a href="#_5-3-2-快速切换到上一个分支" class="header-anchor">#</a> 5.3.2 快速切换到上一个分支</h4> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> checkout -
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h4 id="_5-3-3-只获取所有远程分支"><a href="#_5-3-3-只获取所有远程分支" class="header-anchor">#</a> 5.3.3 只获取所有远程分支</h4> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> branch <span class="token parameter variable">-r</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h4 id="_5-3-4-从另一个分支签出单个文件"><a href="#_5-3-4-从另一个分支签出单个文件" class="header-anchor">#</a> 5.3.4 从另一个分支签出单个文件</h4> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> checkout <span class="token operator">&lt;</span>branch<span class="token operator">&gt;</span> -- <span class="token operator">&lt;</span>file<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h4 id="_5-3-5-删除本地存在远程不存在的分支"><a href="#_5-3-5-删除本地存在远程不存在的分支" class="header-anchor">#</a> 5.3.5 删除本地存在远程不存在的分支</h4> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> remote prune origin
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-4-获取最近一次提交的-hash"><a href="#_5-4-获取最近一次提交的-hash" class="header-anchor">#</a> 5.4 获取最近一次提交的 Hash</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> rev-parse HEAD <span class="token comment"># e10721cb8859b2c</span>
<span class="token comment"># 获取短 hash</span>
<span class="token function">git</span> rev-parse <span class="token parameter variable">--short</span> HEAD <span class="token comment"># e10721c</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h3 id="_5-5-删除已经合并到-master-的分支"><a href="#_5-5-删除已经合并到-master-的分支" class="header-anchor">#</a> 5.5 删除已经合并到 master 的分支</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> branch <span class="token parameter variable">--merged</span> master <span class="token operator">|</span> <span class="token function">grep</span> <span class="token parameter variable">-v</span> <span class="token string">'^\*\|  master'</span> <span class="token operator">|</span> <span class="token function">xargs</span> <span class="token parameter variable">-n</span> <span class="token number">1</span> <span class="token function">git</span> branch <span class="token parameter variable">-d</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-6-查看冲突文件列表"><a href="#_5-6-查看冲突文件列表" class="header-anchor">#</a> 5.6 查看冲突文件列表</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> <span class="token function">diff</span> --name-only --diff-filter<span class="token operator">=</span>U
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-7-展示工作区的冲突文件列表"><a href="#_5-7-展示工作区的冲突文件列表" class="header-anchor">#</a> 5.7 展示工作区的冲突文件列表</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 输出工作区和暂存区的 different (不同)。</span>
<span class="token function">git</span> <span class="token function">diff</span>

<span class="token comment"># 还可以展示本地仓库中任意两个 commit 之间的文件变动：</span>
<span class="token function">git</span> <span class="token function">diff</span> <span class="token operator">&lt;</span>commit-id<span class="token operator">&gt;</span> <span class="token operator">&lt;</span>commit-id<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="_5-8-展示暂存区和最近版本的不同"><a href="#_5-8-展示暂存区和最近版本的不同" class="header-anchor">#</a> 5.8 展示暂存区和最近版本的不同</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> <span class="token function">diff</span> <span class="token parameter variable">--cached</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-9-展示暂存区、工作区和最近版本的不同"><a href="#_5-9-展示暂存区、工作区和最近版本的不同" class="header-anchor">#</a> 5.9 展示暂存区、工作区和最近版本的不同</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 输出工作区、暂存区 和本地最近的版本(commit)的different(不同)。</span>
<span class="token function">git</span> <span class="token function">diff</span> HEAD
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_5-10-删除已经合并到-master-的分支"><a href="#_5-10-删除已经合并到-master-的分支" class="header-anchor">#</a> 5.10 删除已经合并到 master 的分支</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> branch <span class="token parameter variable">--merged</span> master <span class="token operator">|</span> <span class="token function">grep</span> <span class="token parameter variable">-v</span> <span class="token string">'^\*\|  master'</span> <span class="token operator">|</span> <span class="token function">xargs</span> <span class="token parameter variable">-n</span> <span class="token number">1</span> <span class="token function">git</span> branch <span class="token parameter variable">-d</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-11-关联远程分支"><a href="#_5-11-关联远程分支" class="header-anchor">#</a> 5.11 关联远程分支</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 或者在 push 时加上 -u 参数</span>
<span class="token function">git</span> branch <span class="token parameter variable">-u</span> origin/mybranch

<span class="token comment"># 关联之后，git branch -vv 就可以展示关联的远程分支名了, 同时推送到远程仓库直接：git push，不需要指定远程仓库</span>
<span class="token function">git</span> push origin/mybranch <span class="token parameter variable">-u</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="_5-12-查看远程分支和本地分支的对应关系"><a href="#_5-12-查看远程分支和本地分支的对应关系" class="header-anchor">#</a> 5.12 查看远程分支和本地分支的对应关系</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> remote show origin
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-13-展示当前分支的最近的-tag"><a href="#_5-13-展示当前分支的最近的-tag" class="header-anchor">#</a> 5.13 展示当前分支的最近的 tag</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> describe <span class="token parameter variable">--tags</span> <span class="token parameter variable">--abbrev</span><span class="token operator">=</span><span class="token number">0</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-14-修改作者名"><a href="#_5-14-修改作者名" class="header-anchor">#</a> 5.14 修改作者名</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> commit <span class="token parameter variable">--amend</span> <span class="token parameter variable">--author</span><span class="token operator">=</span><span class="token string">'Author Name &lt;email@address.com&gt;'</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-15-增加远程仓库"><a href="#_5-15-增加远程仓库" class="header-anchor">#</a> 5.15 增加远程仓库</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> remote <span class="token function">add</span> origin <span class="token operator">&lt;</span>remote-url<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-16-列出所有远程仓库"><a href="#_5-16-列出所有远程仓库" class="header-anchor">#</a> 5.16 列出所有远程仓库</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> remote <span class="token parameter variable">-v</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-17-从-stash-中拿出某个文件的修改"><a href="#_5-17-从-stash-中拿出某个文件的修改" class="header-anchor">#</a> 5.17 从 stash 中拿出某个文件的修改</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> checkout <span class="token operator">&lt;</span>stash@<span class="token punctuation">{</span>n<span class="token punctuation">}</span><span class="token operator">&gt;</span> -- <span class="token operator">&lt;</span>file-path<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-18-展示所有-tracked-的文件"><a href="#_5-18-展示所有-tracked-的文件" class="header-anchor">#</a> 5.18 展示所有 tracked 的文件</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> ls-files <span class="token parameter variable">-t</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-19-展示所有-untracked-的文件"><a href="#_5-19-展示所有-untracked-的文件" class="header-anchor">#</a> 5.19 展示所有 untracked 的文件</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> ls-files <span class="token parameter variable">--others</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-20-展示所有忽略的文件"><a href="#_5-20-展示所有忽略的文件" class="header-anchor">#</a> 5.20 展示所有忽略的文件</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> ls-files <span class="token parameter variable">--others</span> <span class="token parameter variable">-i</span> --exclude-standard
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-21-把某一个分支导出成一个文件"><a href="#_5-21-把某一个分支导出成一个文件" class="header-anchor">#</a> 5.21 把某一个分支导出成一个文件</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> bundle create <span class="token operator">&lt;</span>file<span class="token operator">&gt;</span> <span class="token operator">&lt;</span>branch-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-22-从包中导入分支"><a href="#_5-22-从包中导入分支" class="header-anchor">#</a> 5.22 从包中导入分支</h3> <p>新建一个分支，分支内容就是上面 <code>git bundle create</code> 命令导出的内容</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> clone repo.bundle <span class="token operator">&lt;</span>repo-dir<span class="token operator">&gt;</span> <span class="token parameter variable">-b</span> <span class="token operator">&lt;</span>branch-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-23-执行-rebase-之前自动-stash"><a href="#_5-23-执行-rebase-之前自动-stash" class="header-anchor">#</a> 5.23 执行 rebase 之前自动 stash</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> rebase <span class="token parameter variable">--autostash</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-24-从远程仓库根据-id-拉下某一状态-到本地分支"><a href="#_5-24-从远程仓库根据-id-拉下某一状态-到本地分支" class="header-anchor">#</a> 5.24 从远程仓库根据 ID，拉下某一状态，到本地分支</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> fetch origin pull/<span class="token operator">&lt;</span>id<span class="token operator">&gt;</span>/head:<span class="token operator">&lt;</span>branch-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-25-详细展示一行中的修改"><a href="#_5-25-详细展示一行中的修改" class="header-anchor">#</a> 5.25 详细展示一行中的修改</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> <span class="token function">diff</span> --word-diff
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-26-清除-gitignore-文件中记录的文件"><a href="#_5-26-清除-gitignore-文件中记录的文件" class="header-anchor">#</a> 5.26 清除 gitignore 文件中记录的文件</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> clean <span class="token parameter variable">-X</span> <span class="token parameter variable">-f</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-27-展示忽略的文件"><a href="#_5-27-展示忽略的文件" class="header-anchor">#</a> 5.27 展示忽略的文件</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> status <span class="token parameter variable">--ignored</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-28-新建并切换到新分支上-同时这个分支没有任何-commit"><a href="#_5-28-新建并切换到新分支上-同时这个分支没有任何-commit" class="header-anchor">#</a> 5.28 新建并切换到新分支上，同时这个分支没有任何 commit</h3> <p>相当于保存修改，但是重写 commit 历史</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> checkout <span class="token parameter variable">--orphan</span> <span class="token operator">&lt;</span>branch-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-29-展示任意分支某一文件的内容"><a href="#_5-29-展示任意分支某一文件的内容" class="header-anchor">#</a> 5.29 展示任意分支某一文件的内容</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> show <span class="token operator">&lt;</span>branch-name<span class="token operator">&gt;</span>:<span class="token operator">&lt;</span>file-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-30-clone-最新一次提交"><a href="#_5-30-clone-最新一次提交" class="header-anchor">#</a> 5.30 clone 最新一次提交</h3> <p>只会 <code>clone</code> 最近一次提交，将减少 <code>clone</code> 时间</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> clone <span class="token parameter variable">--depth</span><span class="token operator">=</span><span class="token number">1</span> https://github.com/user/repo.git
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_5-31-忽略某个文件的改动"><a href="#_5-31-忽略某个文件的改动" class="header-anchor">#</a> 5.31 忽略某个文件的改动</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 关闭 track 指定文件的改动，也就是 Git 将不会在记录这个文件的改动</span>
<span class="token function">git</span> update-index --assume-unchanged path/to/file

<span class="token comment"># 恢复 track 指定文件的改动</span>
<span class="token function">git</span> update-index --no-assume-unchanged path/to/file
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="_5-32-以最后提交的顺序列出所有-git-分支"><a href="#_5-32-以最后提交的顺序列出所有-git-分支" class="header-anchor">#</a> 5.32 以最后提交的顺序列出所有 Git 分支</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 最新的放在最上面</span>
<span class="token function">git</span> for-each-ref <span class="token parameter variable">--sort</span><span class="token operator">=</span>-committerdate <span class="token parameter variable">--format</span><span class="token operator">=</span><span class="token string">'%(refname:short)'</span> refs/heads
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_5-33-把暂存区的指定-file-放到工作区中"><a href="#_5-33-把暂存区的指定-file-放到工作区中" class="header-anchor">#</a> 5.33 把暂存区的指定 file 放到工作区中</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 不添加参数，默认是 -mixed</span>
<span class="token function">git</span> reset <span class="token operator">&lt;</span>file-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_5-34-配置-ssh-协议代理"><a href="#_5-34-配置-ssh-协议代理" class="header-anchor">#</a> 5.34 配置 SSH 协议代理</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 对于使用 git@ 协议的，可以配置 socks5 代理</span>
<span class="token comment"># macOS 系统编辑 ~/.ssh/config 文件，添加这几行，设置 github 代理</span>
Host github.com
  ProxyCommand <span class="token function">nc</span> <span class="token parameter variable">-X</span> <span class="token number">5</span> <span class="token parameter variable">-x</span> <span class="token number">127.0</span>.0.1:1080 %h %p
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h3 id="_5-35-fork仓库同步上游仓库"><a href="#_5-35-fork仓库同步上游仓库" class="header-anchor">#</a> 5.35 Fork仓库同步上游仓库</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 设置上游仓库</span>
<span class="token function">git</span> remote <span class="token function">add</span> upstream https://github.com/jaywcjlove/reference.git

<span class="token comment"># 本地项目操作</span>
<span class="token function">git</span> fetch upstream <span class="token comment"># 获取上游仓库更新</span>
<span class="token function">git</span> stach <span class="token comment"># 暂存本地修改(如果有)</span>
<span class="token function">git</span> branch <span class="token parameter variable">-a</span> <span class="token comment"># 列出所有远程仓库地址(非必须)</span>
<span class="token function">git</span> rebase remotes/upstream/main <span class="token comment"># 使用远程仓库的提交记录来重写本地提交记录</span>
<span class="token function">git</span> push <span class="token parameter variable">-f</span> <span class="token comment"># 强制推送到远程(github)仓库</span>
<span class="token function">git</span> stach pop <span class="token comment"># 恢复暂存的本地修改(如果有</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><h2 id="_6-统计查询"><a href="#_6-统计查询" class="header-anchor">#</a> 6. 统计查询</h2> <h3 id="_6-1-查看-git-上的个人代码量"><a href="#_6-1-查看-git-上的个人代码量" class="header-anchor">#</a> 6.1 查看 git 上的个人代码量</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># username 需要改成自己的</span>
<span class="token function">git</span> log <span class="token parameter variable">--author</span><span class="token operator">=</span><span class="token string">&quot;username&quot;</span> <span class="token parameter variable">--pretty</span><span class="token operator">=</span>tformat: <span class="token parameter variable">--numstat</span> <span class="token operator">|</span> <span class="token function">awk</span> <span class="token punctuation">\</span>
<span class="token string">'{ add += $1; subs += $2; loc += $1 - $2 } END { printf &quot;added lines: %s, removed lines: %s, total lines: %s\n&quot;, add, subs, loc }'</span> -
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h3 id="_6-2-统计每个人增删行数"><a href="#_6-2-统计每个人增删行数" class="header-anchor">#</a> 6.2 统计每个人增删行数</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> log <span class="token parameter variable">--format</span><span class="token operator">=</span><span class="token string">'%aN'</span> <span class="token operator">|</span> <span class="token function">sort</span> <span class="token parameter variable">-u</span> <span class="token operator">|</span><span class="token punctuation">\</span>
  <span class="token keyword">while</span> <span class="token builtin class-name">read</span> name<span class="token punctuation">;</span> <span class="token keyword">do</span> <span class="token builtin class-name">echo</span> <span class="token parameter variable">-en</span> <span class="token string">&quot;<span class="token variable">$name</span><span class="token entity" title="\t">\t</span>&quot;</span><span class="token punctuation">;</span><span class="token punctuation">\</span>
  <span class="token function">git</span> log <span class="token parameter variable">--author</span><span class="token operator">=</span><span class="token string">&quot;<span class="token variable">$name</span>&quot;</span> <span class="token parameter variable">--pretty</span><span class="token operator">=</span>tformat: <span class="token parameter variable">--numstat</span> <span class="token operator">|</span> <span class="token function">awk</span> <span class="token punctuation">\</span>
  <span class="token string">'{ add += $1; subs += $2; loc += $1 - $2 } END { printf &quot;added lines: %s, removed lines: %s, total lines: %s\n&quot;, add, subs, loc }'</span> -<span class="token punctuation">;</span> <span class="token keyword">done</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h3 id="_6-3-查看仓库提交者排名"><a href="#_6-3-查看仓库提交者排名" class="header-anchor">#</a> 6.3 查看仓库提交者排名</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 这里是排名前十，也可以更改排名</span>
<span class="token function">git</span> log <span class="token parameter variable">--pretty</span><span class="token operator">=</span><span class="token string">'%aN'</span> <span class="token operator">|</span> <span class="token function">sort</span> <span class="token operator">|</span> <span class="token function">uniq</span> <span class="token parameter variable">-c</span> <span class="token operator">|</span> <span class="token function">sort</span> <span class="token parameter variable">-k1</span> <span class="token parameter variable">-n</span> <span class="token parameter variable">-r</span> <span class="token operator">|</span> <span class="token function">head</span> <span class="token parameter variable">-n</span> <span class="token number">10</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_6-4-提交数统计"><a href="#_6-4-提交数统计" class="header-anchor">#</a> 6.4 提交数统计</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> log <span class="token parameter variable">--oneline</span> <span class="token operator">|</span> <span class="token function">wc</span> <span class="token parameter variable">-l</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_6-5-查看某段代码是谁写的"><a href="#_6-5-查看某段代码是谁写的" class="header-anchor">#</a> 6.5 查看某段代码是谁写的</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> blame <span class="token operator">&lt;</span>file-name<span class="token operator">&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_6-5-查看两个星期内的改动"><a href="#_6-5-查看两个星期内的改动" class="header-anchor">#</a> 6.5 查看两个星期内的改动</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> whatchanged <span class="token parameter variable">--since</span><span class="token operator">=</span><span class="token string">'2 weeks ago'</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_6-6-在-commit-log-中查找相关内容"><a href="#_6-6-在-commit-log-中查找相关内容" class="header-anchor">#</a> 6.6 在 commit log 中查找相关内容</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> log <span class="token parameter variable">--all</span> <span class="token parameter variable">--grep</span><span class="token operator">=</span><span class="token string">'&lt;given-text&gt;'</span>
<span class="token comment"># 通过 grep 查找，given-text: 所需要查找的字段</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="_6-7-git-仓库的大小"><a href="#_6-7-git-仓库的大小" class="header-anchor">#</a> 6.7 Git 仓库的大小</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> ls-files <span class="token operator">|</span> <span class="token function">xargs</span> <span class="token parameter variable">-r</span> <span class="token function">du</span> <span class="token parameter variable">-hs</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_6-8-git-仓库的总大小"><a href="#_6-8-git-仓库的总大小" class="header-anchor">#</a> 6.8 Git 仓库的总大小</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> count-objects <span class="token parameter variable">-vH</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_6-9-查询历史体积大的-10-个文件"><a href="#_6-9-查询历史体积大的-10-个文件" class="header-anchor">#</a> 6.9 查询历史体积大的 10 个文件</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">git</span> rev-list <span class="token parameter variable">--objects</span> <span class="token parameter variable">--all</span> <span class="token operator">|</span> <span class="token function">git</span> cat-file --batch-check<span class="token operator">=</span><span class="token string">'%(objecttype) %(objectname) %(objectsize) %(rest)'</span> <span class="token operator">|</span> <span class="token function">awk</span> <span class="token string">'/^blob/ {print substr($0,6)}'</span> <span class="token operator">|</span> <span class="token function">sort</span> --numeric-sort <span class="token parameter variable">--key</span><span class="token operator">=</span><span class="token number">2</span> <span class="token parameter variable">--reverse</span> <span class="token operator">|</span> <span class="token function">head</span> <span class="token parameter variable">-n</span> <span class="token number">10</span> <span class="token operator">|</span> <span class="token function">cut</span> <span class="token parameter variable">-c</span> <span class="token number">13</span>-
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></div></div> <!----> <div class="page-edit"><!----> <!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2024/6/3 14:54:44</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/pages/1ab9a6/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">Shell 脚本学习笔记</div></a> <a href="/pages/883f02/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">Power_Destory 项目</div></a></div> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/pages/1ab9a6/" class="prev">Shell 脚本学习笔记</a></span> <span class="next"><a href="/pages/883f02/">Power_Destory 项目</a>→
      </span></p></div></div></div> <!----></main></div> <div class="footer"><!----> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2023-2025
    <span>霜晨月</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"><canvas id="vuepress-canvas-cursor"></canvas></div></div>
    <script src="/assets/js/app.67adcfd9.js" defer></script><script src="/assets/js/4.9aaa1650.js" defer></script><script src="/assets/js/1.5474518c.js" defer></script><script src="/assets/js/3.593d14fc.js" defer></script><script src="/assets/js/162.1d48f266.js" defer></script>
  </body>
</html>
